/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author lzw
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadFileParams } from '/#/axios';
import { UploadApiResult } from '../sys/upload';

const { ctxPath, adminPath } = useGlobSetting();

export interface CreateLawsuitFile extends BasicModel<CreateLawsuitFile> {
  dataSource?: string; // 数据来源
  createNumber?: number; // 生成数量
  deficiency?: number; // 缺少材料项
  isCheckNumber?: number; // 需检查项
  filePath?: string; // 生成地址
  gjz?: string;
}

export const createLawsuitFileList = (params?: CreateLawsuitFile | any) =>
  defHttp.get<CreateLawsuitFile>({ url: adminPath + '/operating/createLawsuitFile/list', params });

export const createLawsuitFileListData = (params?: CreateLawsuitFile | any) =>
  defHttp.post<Page<CreateLawsuitFile>>({
    url: adminPath + '/operating/createLawsuitFile/listData',
    params,
  });

export const createLawsuitFileForm = (params?: CreateLawsuitFile | any) =>
  defHttp.get<CreateLawsuitFile>({ url: adminPath + '/operating/createLawsuitFile/form', params });

export const createLawsuitFileSave = (params?: any, data?: CreateLawsuitFile | any) =>
  defHttp.postJson<CreateLawsuitFile>({
    url: adminPath + '/operating/createLawsuitFile/save',
    params,
    data,
  });

export const createLawsuitFileDelete = (params?: CreateLawsuitFile | any) =>
  defHttp.get<CreateLawsuitFile>({
    url: adminPath + '/operating/createLawsuitFile/delete',
    params,
  });

export const createLawsuitFileImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/operating/createLawsuitFile/importData',
      onUploadProgress,
    },
    params,
  );
